import RootStatus from "../RootStatus";
import { PlayerActions, PlayerStatusMachine } from "../PlayerStatusMachine";

const { ccclass, property } = cc._decorator;

@ccclass
export default class RollingStatus extends RootStatus {

    onEnter() {
        this.spritePlayer.getComponent(cc.Animation).play("player_roll");
        super.onEnter();
    }

    onExit() {
        super.onExit();
        this.machine.mainPlayer.nPlayerRunSpeed = 2;
    }

    onUpdate(dt: number) {

    }

    onAnimationFinished() {
        if (this.machine.mainPlayer.bPlayerInRunning) {
            this.machine.changeStatus(PlayerActions.move);
        }
        else {
            this.machine.changeStatus(PlayerActions.stand1);
        }
    }
}
